<template>
  <div >
    <iframe :src="baseUrl" id="map" scrolling="yes" frameborder="0"></iframe>
  </div>
</template>


<script>
  export default {
    data () {
      return {
        baseUrl: 'http://localhost:8080/druid/index.html'

      }
    },
    created() {
      this.baseUrl = process.env.BASE_API + '/druid/index.html'
    },
    mounted(){
      /**
       * iframe-宽高自适应显示
       */
      function changeMapIframe(){
        const map = document.getElementById('map');
        const deviceWidth = document.body.clientWidth;
        const deviceHeight = document.body.clientHeight;
        map.style.width = (Number(deviceWidth)-240) + 'px'; //数字是页面布局宽度差值
        map.style.height = (Number(deviceHeight)+600) + 'px'; //数字是页面布局高度差
      }

      changeMapIframe()

      window.onresize = function(){
        changeMapIframe()
      }
    }
  }
</script>
